/* Copyright 2009 Requirements Management System 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.mags.remas.control;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
import org.mags.remas.model.entity.EntityRelationship;
import org.mags.remas.view.commons.ImageProvider;

/**
 * 
 * @author Mario Gaitan
 *
 */
public abstract class RelationshipEditorInput implements IEditorInput {
	final protected EntityRelationship entityRelationship;
	final private String className;
	private long ID = 0;
	public void setID(long ID) {
		this.ID = ID;
	}
	public long getID() {
		return ID;
	}
	public String getClassName() {
		return className;
	}
	public EntityRelationship getEntityRelationship() {
		return entityRelationship;
	}
	public RelationshipEditorInput(EntityRelationship entityRelationship, String className) {
		this.entityRelationship = entityRelationship;
		this.className = className;
	}
	public void setViewController() {
	}
	@Override
	public boolean exists() {
		return false;
	}
	@Override
	public ImageDescriptor getImageDescriptor() {
		return ImageProvider.getEntityImageDescriptor(entityRelationship.getEntity().getEntityType().getCode().toLowerCase()+".png");
	}
	@Override
	public String getName() {
		return entityRelationship.getEntity().getName();
	}
	@Override
	public IPersistableElement getPersistable() {
		return null;
	}
	@Override
	public String getToolTipText() {
		return entityRelationship.getEntity().getName();
	}
	@Override
	public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
		return null;
	}
}
